#ifndef MYTHREAD_H
#define MYTHREAD_H

#include <QRunnable>
#include <QThread>
#include <QObject>

class Generate : public QObject, public QRunnable
{
    Q_OBJECT
public:
    explicit Generate(QObject *parent = nullptr);
    void recvNum(int num);
    void run() override;

signals:
    void sendVector(QVector<int> qv); // 该信号用于将数据发送给主线程
private:
    int _num; // 主线程传递num值
};

class BubbleSort : public QObject, public QRunnable
{
    Q_OBJECT
public:
    explicit BubbleSort(QObject *parent = nullptr);
    void recvVector(QVector<int> qv);
    void run() override;

signals:
    void finish(QVector<int> qv); // 该信号用于将数据发送给主线程
private:
    QVector<int> _qv; // 主线程传递num值
};

class QuickSort : public QObject, public QRunnable
{
    Q_OBJECT
public:
    explicit QuickSort(QObject *parent = nullptr);
    void recvVector(QVector<int> qv);
    void run() override;

private:
    void quickSort(QVector<int> &qv, int begin, int end);

signals:
    void finish(QVector<int> qv); // 该信号用于将数据发送给主线程
private:
    QVector<int> _qv; // 主线程传递num值
};
#endif // MYTHREAD_H
